package com.liarjo.mywebsiteapi.config;

import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import jakarta.annotation.PostConstruct;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Component
@Data
@Slf4j
@ConfigurationProperties(prefix = "app")
public class AppConfig {
    private Cors cors = new Cors();
    private String uploadDir;

    @Data
    public class Cors {
        private List<String> allowedOriginList;
    }

    @PostConstruct
    public void printConfigInfo() {
        log.info("AppConfig - uploadDir: " + uploadDir);
        log.info("AppConfig - allowedOriginList: " + cors.getAllowedOriginList());
    }
}
